from tkinter import*
root = Tk()
root.title("ИТ марафон")
root.geometry("500x500")

canvas = Canvas(bg="white", width=500, height=500)
canvas.pack(anchor=CENTER, expand=1)
def rectangle(a,b,c,H):
    #brushColor("blue")
    #penColor("blue")
    canvas.create_polygon( 0+x,0+y, a*H+x,0+y, a*H+x,b*H+y, 0+x,b*H+y, 0+x,0+y, fill='blue' , outline = 'blue' )
    canvas.create_polygon( a*H+x,a*H+y, b*H+x,a*H+y, b*H+x,c*H+y, a*H+x,c*H+y, a*H+x,c*H+y, fill='blue' , outline = 'blue' )

def kub(x, y):
    rectangle(a, b, c, H)



x= float (input ("x= ") )
y = float (input("y= ") )

H = float (input("H= ") )


if H == 0 and x>=0 and x<=500 and y>=0 and y<=500:
    pass
else:
    if H > 0 and 0*H+x>=0 and 0*H+y>=0 and 20*H+x<=500 and 20*H+y<=500:
        pass
    else:
        if H < 0 and 20*H+x>=0 and 20*H+y>=0 and 0*H+x<=500 and 0*H+y<=500:
            pass
        else:
            print('Размер фигуры превышает максимальный рвзмер поля')
            exit()

a=20
b=40
c=60

kub(x, y)


rectangle(a,b,c,H)
root.mainloop()